//地图
var map = new BMap.Map("container");          // 创建地图实例
var point = new BMap.Point(114.003083, 22.669418);  // 创建点坐标
map.centerAndZoom(point, 12);                 // 初始化地图，设置中心点坐标和地图级别
map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

var points = new BMap.Point(114.003083, 22.669418);// 创建点坐标
var marker = new BMap.Marker(points);        // 创建标注
map.addOverlay(marker);                     // 将标注添加到地图中

var pointe = new BMap.Point(113.828792, 22.663719);
var markers = new BMap.Marker(pointe);        // 创建标注   
map.addOverlay(markers);                     // 将标注添加到地图中

var options = {
    renderOptions: { map: map },
    onSearchComplete: function (results) {
        // 判断状态是否正确
        if (local.getStatus() == BMAP_STATUS_SUCCESS) {
            var s = [];
            for (var i = 0; i < results.getCurrentNumPois(); i++) {
                s.push(results.getPoi(i).title + ", " + results.getPoi(i).address);
            }
            $('#sch').click(function () {
                var keyword = $(this).find('#two').text(); console.log(keyword)
                localSearch.setSearchCompleteCallback(function (searchResult) {
                    var poi = searchResult.getPoi(0);
                });
                localSearch.search(keyword);
            });
        }
    }
};

var local = new BMap.LocalSearch(map, options);
$('#sch').click(function () {
    local.search($("#two").val());
});